package com.xgp.Software.mapper;

import com.xgp.Software.model.Question;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;

import java.util.List;

@Mapper
public interface QuestionExtMapper {

    @Update("update question set view_count = view_count + 1 where id = #{id}")
    void incView(Long id);

    @Update("update question set comment_count = comment_count + 1 where id = #{id}")
    void incCommentCount(Long id);

    @Select("select * from question where id != #{id} and tag regexp #{tag} order by gmt_create desc limit 10")
    List<Question> selectRelated(Question question);
}
